<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../JS/vue.js"></script>
</head>
<body>
  



    <!-- 准备好一个容器 -->
    <div id="root">
        <input type="text" @keydown="showInfo">        
    </div>
    

    

</body>

<script type="text/javascript">
    Vue.config.productionTip = false  // 阻止启动时产生提示

    //创建Vue实例
    new Vue({
        el:'#root',// 用于指定当前Vue实例为哪个容
        methods:{
            showInfo(e){
                console.log(1);
                console.log(e.key,e.keyCode); // 显示当前按键的名称和编码
            }
        }
    });

    
</script>
</html>